home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Screenblankers / XSB / setwaitpointer.c < prev    next >
Text File  |  1996-09-26  |  2KB  |  90 lines

  1. /* setwaitpointer.c
  2.  * Copyright (C) 1990, 1991 Commodore-Amiga, Inc.
  3.  * Written by David N. Junod
  4.  *
  5.  */
  6.  
  7. static UWORD chip WaitPointer[] =
  8. {
  9.     0x0000, 0x0000,
  10.  
  11.     0x0400, 0x07C0,
  12.     0x0000, 0x07C0,
  13.     0x0100, 0x0380,
  14.     0x0000, 0x07E0,
  15.     0x07C0, 0x1FF8,
  16.     0x1FF0, 0x3FEC,
  17.     0x3FF8, 0x7FDE,
  18.     0x3FF8, 0x7FBE,
  19.     0x7FFC, 0xFF7F,
  20.     0x7EFC, 0xFFFF,
  21.     0x7FFC, 0xFFFF,
  22.     0x3FF8, 0x7FFE,
  23.     0x3FF8, 0x7FFE,
  24.     0x1FF0, 0x3FFC,
  25.     0x07C0, 0x1FF8,
  26.     0x0000, 0x07E0,
  27.  
  28.     0x0000, 0x0000,        /* reserved, must be NULL */
  29. };
  30.  
  31. /* This function sets the busy pointer in the specified window */
  32. VOID SetWaitPointer (struct Window * w)
  33. {
  34.  
  35.     if (w)
  36.     {
  37.     SetPointer (w, WaitPointer, 16, 16, -6, 0);
  38.     }
  39. }
  40.  
  41. /* This function sets the busy pointer, and locks the gadgets for the
  42.  * specified window.
  43.  *
  44.  * Example:
  45.  *
  46.  *    VOID DoSomethingLong (struct Window *w)
  47.  *    {
  48.  *        struct Requester r;
  49.  *
  50.  *        LockWindow (w, &r);
  51.  *
  52.  *        ... do the work ...
  53.  *
  54.  *        UnlockWindow (w, &r);
  55.  *    }
  56.  *
  57.  */
  58.  
  59. static struct Requester r;
  60.  
  61. VOID LockWindow (struct Window *w)
  62. {
  63.     /* Make sure we have a window */
  64.     if (w)
  65.     {
  66.     /* Set the wait pointer */
  67.     SetWaitPointer (w);
  68.  
  69.             InitRequester (&r);
  70.  
  71.             r.LeftEdge = r.TopEdge = (-1);
  72.             r.Width = r.Height = 1;
  73.             r.Flags = SIMPLEREQ | NOREQBACKFILL;
  74.  
  75.             Request (&r, w);
  76.     }
  77. }
  78.  
  79. VOID UnlockWindow (struct Window *w)
  80. {
  81.     /* Make sure we have a window */
  82.     if (w)
  83.     {
  84.         EndRequest (&r, w);
  85.  
  86.     /* Turn off the busy pointer */
  87.     ClearPointer (w);
  88.     }
  89. }
  90.